using NUnit.Framework;
using ValidationFramework.Configuration;
using ValidationFramework.Extensions;

namespace ValidationFramework.Tests.Configuration
{
    [TestFixture]
	public class EnumConversionRuleConfigReaderTest
    {
		public enum Numbers
		{
			One,
			Two,
			Three
		}
        #region Methods

        [Test]
        public void ReadConfig()
        {
            const string validatorXml = "<rule errorMessage='hello' ruleSet='foo' typeName='EnumConversionRule' enumTypeName='ValidationFramework.Tests.Configuration.EnumConversionRuleConfigReaderTest+Numbers,ValidationFramework.Tests' ignoreCase='true'/>";
            var ruleData = (RuleData.Read(validatorXml.ToXmlReader()));
			var rule = (EnumConversionRule)ConfigurationService.GetRule(ruleData, typeof(string).TypeHandle);
            Assert.AreEqual("hello", rule.ErrorMessage);
			Assert.AreEqual(typeof(Numbers), rule.EnumType);
			Assert.AreEqual(true, rule.IgnoreCase);

        }

        #endregion


    }
}